package org.crud4j.ejb3;

import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

import org.crud4j.ejb3.example.Student;
import org.crud4j.ejb3.example.Teacher;

public class ExampleEjb3BeanProvider implements Ejb3BeanProvider {

	private static Class[] CLASSES = new Class[] { Teacher.class, Student.class };

	private EntityManagerFactory emf;

	public ExampleEjb3BeanProvider() {
		super();
		emf = Persistence.createEntityManagerFactory("crud-test");
		if (emf == null) {
			throw new IllegalStateException(
					"unable to create EntityManagerFactory");
		}
	}

	public EntityManagerFactory getEntityManagerFactory() {
		return emf;
	}

	public Class[] listClasses() {
		return CLASSES;
	}

}
